package 力扣._409_最长回文串;

public class Solution2 {
    public int longestPalindrome(String s) {
        //可进一步简化为，统计奇数的个数
        int[] t = new int[128];
        for (int i = 0; i < s.length(); i++) {
            t[s.charAt(i)]++;
        }
        int count = 0;
        for (int j : t) {
            if (j % 2 == 1)
                count++;
        }
        return count == 0 ? s.length() : s.length() - count + 1;
    }

    public static void main(String[] args) {
        int i = new Solution2().longestPalindrome("abccccdd");
    }
}
